<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div class="box">
    盒子1
</div>
<div class="box">
    盒子2
</div>
<script>
    var box1 = document.getElementsByClassName('box');
    console.log(box1);
    var firstBox = document.querySelector('.box');
    console.log(firstBox);
    var AllBox = document.querySelectorAll('.box');
    console.log(AllBox);
</script>
</body>
</html>